package com.mrptech.mess.model;

// Generated Feb 15, 2015 10:58:50 PM by Hibernate Tools 4.0.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * RolesHierarchy generated by hbm2java
 */
@Entity
@Table(name = "ROLES_HIERARCHY")
public class RolesHierarchy implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private RolesHierarchyId id;
	private Hierarchy hierarchy;
	private Roles roles;

	public RolesHierarchy() {
	}

	public RolesHierarchy(RolesHierarchyId id, Hierarchy hierarchy, Roles roles) {
		this.id = id;
		this.hierarchy = hierarchy;
		this.roles = roles;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "roleCode", column = @Column(name = "ROLE_CODE", nullable = false, length = 30)),
			@AttributeOverride(name = "nodeCode", column = @Column(name = "NODE_CODE", nullable = false, length = 30)),
			@AttributeOverride(name = "productCode", column = @Column(name = "PRODUCT_CODE", nullable = false, length = 10)) })
	public RolesHierarchyId getId() {
		return this.id;
	}

	public void setId(RolesHierarchyId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NODE_CODE", nullable = false, insertable = false, updatable = false)
	public Hierarchy getHierarchy() {
		return this.hierarchy;
	}

	public void setHierarchy(Hierarchy hierarchy) {
		this.hierarchy = hierarchy;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({
			@JoinColumn(name = "ROLE_CODE", referencedColumnName = "ROLE_CODE", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "PRODUCT_CODE", referencedColumnName = "PRODUCT_CODE", nullable = false, insertable = false, updatable = false) })
	public Roles getRoles() {
		return this.roles;
	}

	public void setRoles(Roles roles) {
		this.roles = roles;
	}

}
